/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cassys.data.hibernate;

import cassys.data.LectureDAO;
import cassys.domain.classManagement.Lecture;
import org.hibernate.Query;
/**
 *
 * @author User
 */
public class LectureHibernateDAO extends GenericHibernateDAO<Lecture, Long>
        implements LectureDAO {

    @Override
    public Lecture getLectureByName(String name) {
        Lecture lecture = null;
        String hql = "FROM Lecture l WHERE l.name = :name";

        try {
            Query query = super.getSession().createQuery(hql);
            query.setString("name", name);
            lecture = (Lecture) query.uniqueResult();
        } catch (Throwable t) {
            System.out.println(t.getMessage());
          //  throw new HibernateAccessLayerException(t.toString());
        }

        return lecture;
    }
}
